
*Set working directory
cd "" // Indicate where data is stored

*Load data
use "data.dta", clear

*Analysis

*Table 3 (Model 1 - empty)
melogit follow || politician:
estat ic

*Table 3 (Model 1)
melogit follow c.engagement_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

*Figure 1 (left)
margins, at(engagement_lag=(0 (10000) 100000)) atmeans
marginsplot, recastci(rarea)

*Table 3 (Model 2 - empty)
melogit action || politician:
estat ic

*Table 3 (Model 2)
melogit action c.engagement_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

*Figure 1 (right)
margins, at(engagement_lag=(0 (10000) 100000)) atmeans
marginsplot, recastci(rarea)


*Supplementary materials A 
use "data.dta", clear
drop if country == 1 //Australia out 

*Table A1
melogit follow || politician:
estat ic
melogit follow c.engagement_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

melogit action || politician:
estat ic
melogit action c.engagement_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

use "data.dta", clear
drop if country == 2 //Belgium out 

*Table A2
melogit follow || politician:
estat ic
melogit follow c.engagement_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

melogit action || politician:
estat ic
melogit action c.engagement_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

use "data.dta", clear
drop if country == 3 //US out 

*Table A3
melogit follow || politician:
estat ic
melogit follow c.engagement_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

melogit action || politician:
estat ic
melogit action c.engagement_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic


*Supplementary materials B
use "data.dta", clear

*Omitting top issues per country
drop if country == 3 & issue == 18 // international relations
drop if country == 3 & issue == 16 // technology
drop if country == 3 & issue == 3  // health
drop if country == 3 & issue == 14 // banking
drop if country == 3 & issue == 2 // civil rights

drop if country == 2 & issue == 3 // health
drop if country == 2 & issue == 11 // law and crime
drop if country == 2 & issue == 18 // international relations
drop if country == 2 & issue == 15 // defence
drop if country == 2 & issue == 5 // labour


drop if country == 1 & issue == 16 // technology
drop if country == 1 & issue == 12 // social welfare
drop if country == 1 & issue == 18 // international relations
drop if country == 1 & issue == 3 // health
drop if country == 1 & issue == 2 // civil rights

*Table B2
melogit follow || politician:
estat ic
melogit follow c.engagement_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

melogit action || politician:
estat ic
melogit action c.engagement_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic



*Supplementary materials C
use "data.dta", clear

xtset politician_issue_id electoral_cycle

*Table C1 (Model 1)
xtlogit follow
estat ic
xtlogit follow c.engagement_log c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country i.issue
estat ic

*Table C1 (Model 2)
xtlogit action
estat ic
xtlogit action c.engagement_log c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country i.issue
estat ic

*Table C2 (Model 1)
xtlogit follow
estat ic
xtlogit follow c.engagement_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country i.issue
estat ic

*Table C2 (Model 2)
xtlogit action
estat ic
xtlogit action c.engagement_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country i.issue
estat ic

*Supplementary materials D
use "data.dta", clear
*Table D.1
melogit follow || politician:
estat ic
melogit follow c.engagement_log c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

melogit action || politician:
estat ic
melogit action c.engagement_log c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic


*Table D.2
melogit follow || politician:
estat ic
melogit follow c.Likes_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

melogit action || politician:
estat ic
melogit action c.Likes_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic


*Table D.3
melogit follow || politician:
estat ic
melogit follow c.Comments_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

melogit action || politician:
estat ic
melogit action c.Comments_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

*Table D.4
melogit follow || politician:
estat ic
melogit follow c.Shares_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

melogit action || politician:
estat ic
melogit action c.Shares_lag c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic


*Supplementary materials E

*Table E (Model 1)
melogit follow || politician:
estat ic
melogit follow c.engagement_lag##c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

*Figure 2 (left)
margins, at(engagement_lag=(0 (10000) 100000) issue_salience_lag=(300000 600000)) atmeans
marginsplot, recastci(rarea)

*Table E (Model 2)
melogit action || politician:
estat ic
melogit action c.engagement_lag##c.issue_salience_lag c.pol_interest_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

*Figure 2 (right)
margins, at(engagement_lag=(0 (10000) 100000) issue_salience_lag=(300000 600000)) atmeans
marginsplot, recastci(rarea)


*Supplementary materials F

*Table F (Model 1)
melogit follow || politician:
estat ic
melogit follow c.engagement_lag##c.pol_interest_lag c.issue_salience_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

*Figure 3 (left)
margins, at(engagement_lag=(0 (10000) 100000) pol_interest_lag=(20 80)) atmeans
marginsplot, recastci(rarea)

*Table F (Model 2)
melogit action || politician:
estat ic
melogit action c.engagement_lag##c.pol_interest_lag c.issue_salience_lag i.action_lag i.follow_lag i.country c.electoral_cycle i.issue || politician:
estat ic

*Figure 3 (right)
margins, at(engagement_lag=(0 (10000) 100000) pol_interest_lag=(20 80)) atmeans
marginsplot, recastci(rarea)

